<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>集成服务 - UserHub</title>
    <!-- 引入Tailwind CSS -->
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- 引入Font Awesome -->
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <!-- 引入自定义CSS -->
    <link rel="stylesheet" href="settings-integrations.css">
</head>
<body class="font-inter bg-gray-50 text-dark min-h-screen flex flex-col">
    <!-- 导航栏 -->
    <header class="bg-white shadow-sm sticky top-0 z-50">
        <div class="container mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <!-- 左侧Logo和导航 -->
                <div class="flex items-center">
                    <div class="flex-shrink-0 flex items-center">
                        <i class="fa fa-connectdevelop text-primary text-2xl mr-2"></i>
                        <span class="font-bold text-xl text-primary">UserHub</span>
                    </div>
                    <nav class="hidden md:ml-10 md:flex md:space-x-8">
                        <a href="dashboard.html" class="text-gray-500 hover:text-primary hover:border-primary inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium transition-colors duration-200">
                            首页
                        </a>
                        <a href="messages.html" class="text-gray-500 hover:text-primary hover:border-primary inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium transition-colors duration-200">
                            消息
                        </a>
                        <a href="tasks.html" class="text-gray-500 hover:text-primary hover:border-primary inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium transition-colors duration-200">
                            任务
                        </a>
                        <a href="settings-profile.html" class="text-primary border-primary inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">
                            设置
                        </a>
                    </nav>
                </div>
                
                <!-- 右侧用户区域 -->
                <div class="flex items-center">
                    <!-- 搜索按钮 -->
                    <button class="p-2 rounded-full text-gray-500 hover:text-primary hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary mr-2 transition-colors duration-200">
                        <i class="fa fa-search"></i>
                    </button>
                    
                    <!-- 通知按钮 -->
                    <button class="p-2 rounded-full text-gray-500 hover:text-primary hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary relative mr-2 transition-colors duration-200">
                        <i class="fa fa-bell"></i>
                        <span class="absolute top-1 right-1 block h-2 w-2 rounded-full bg-red-500 ring-2 ring-white"></span>
                    </button>
                    
                    <!-- 用户菜单 -->
                    <div class="ml-3 relative">
                        <div>
                            <button type="button" class="flex items-center max-w-xs rounded-full text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary" id="user-menu-button">
                                <img class="h-8 w-8 rounded-full object-cover" src="https://picsum.photos/id/64/200/200" alt="用户头像" id="header-avatar">
                                <span class="ml-2 hidden md:block text-sm font-medium text-gray-700" id="user-display-name">张三</span>
                                <i class="fa fa-chevron-down ml-1 text-xs text-gray-500"></i>
                            </button>
                        </div>
                    </div>
                     <div class="user-menu-dropdown hidden absolute right-0 mt-2 w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-50" id="user-menu-dropdown">
                            <div class="py-1">
                                <button class="user-menu-item w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" onclick="window.location.href='settings-profile.html'">
                                    <i class="fa fa-user-circle mr-2"></i>个人资料
                                </button>
                                <button class="user-menu-item w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" onclick="window.location.href='settings-security.html'">
                                    <i class="fa fa-lock mr-2"></i>账户安全
                                </button>
                                <button class="user-menu-item w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" onclick="window.location.href='settings-notifications.html'">
                                    <i class="fa fa-bell mr-2"></i>通知设置
                                </button>
                                <div class="border-t border-gray-100 my-1"></div>
                                <button class="user-menu-item w-full text-left px-4 py-2 text-sm text-red-500 hover:bg-gray-100" id="logout-button">
                                    <i class="fa fa-sign-out mr-2"></i>退出登录
                                </button>
                            </div>
                        </div>
                    
                    <!-- 移动端菜单按钮 -->
                    <button type="button" class="ml-4 md:hidden inline-flex items-center justify-center p-2 rounded-md text-gray-500 hover:text-primary hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary" id="mobile-menu-button">
                        <i class="fa fa-bars"></i>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- 移动端导航菜单 -->
        <div class="md:hidden hidden" id="mobile-menu">
            <div class="px-2 pt-2 pb-3 space-y-1 sm:px-3">
                <a href="dashboard.html" class="text-gray-500 hover:bg-gray-50 hover:text-primary hover:border-primary block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium">
                    首页
                </a>
                <a href="messages.html" class="text-gray-500 hover:bg-gray-50 hover:text-primary hover:border-primary block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium">
                    消息
                </a>
                <a href="tasks.html" class="text-gray-500 hover:bg-gray-50 hover:text-primary hover:border-primary block pl-3 pr-4 py-2 border-l-4 border-transparent text-base font-medium">
                    任务
                </a>
                <a href="settings-profile.html" class="bg-primary/10 text-primary block pl-3 pr-4 py-2 border-l-4 border-primary text-base font-medium">
                    设置
                </a>
            </div>
        </div>
    </header>

    <!-- 主内容区域 -->
    <main class="flex-grow container mx-auto px-4 sm:px-6 lg:px-8 py-8">
        <!-- 页面标题 -->
        <div class="mb-8">
            <h1 class="text-[clamp(1.5rem,3vw,2.5rem)] font-bold">设置</h1>
            <p class="text-gray-500 mt-1">管理您的账户设置和偏好</p>
        </div>
        
        <div class="flex flex-col lg:flex-row gap-8">
            <!-- 左侧设置导航 -->
            <div class="lg:w-1/4">
                <div class="bg-white rounded-xl shadow-sm overflow-hidden sticky top-24">
                    <div class="p-4 border-b border-gray-100">
                        <h3 class="font-medium">设置选项</h3>
                    </div>
                    <nav class="p-2">
                        <a href="settings-profile.html" class="setting-nav-item flex items-center px-4 py-3 text-sm font-medium text-gray-700 rounded-lg mb-1 hover:bg-gray-50 transition-colors">
                            <i class="fa fa-user-circle w-5 text-center mr-3"></i>
                            <span>个人资料</span>
                        </a>
                        <a href="settings-security.html" class="setting-nav-item flex items-center px-4 py-3 text-sm font-medium text-gray-700 rounded-lg mb-1 hover:bg-gray-50 transition-colors">
                            <i class="fa fa-lock w-5 text-center mr-3"></i>
                            <span>账户安全</span>
                        </a>
                        <a href="settings-notifications.html" class="setting-nav-item flex items-center px-4 py-3 text-sm font-medium text-gray-700 rounded-lg mb-1 hover:bg-gray-50 transition-colors">
                            <i class="fa fa-bell w-5 text-center mr-3"></i>
                            <span>通知设置</span>
                        </a>
                        <a href="settings-privacy.html" class="setting-nav-item flex items-center px-4 py-3 text-sm font-medium text-gray-700 rounded-lg mb-1 hover:bg-gray-50 transition-colors">
                            <i class="fa fa-shield w-5 text-center mr-3"></i>
                            <span>隐私设置</span>
                        </a>
                        <a href="settings-integrations.html" class="setting-nav-item nav-item-active flex items-center px-4 py-3 text-sm font-medium rounded-lg mb-1 transition-colors">
                            <i class="fa fa-plug w-5 text-center mr-3"></i>
                            <span>集成服务</span>
                        </a>
                        <a href="settings-about.html" class="setting-nav-item flex items-center px-4 py-3 text-sm font-medium text-gray-700 rounded-lg hover:bg-gray-50 transition-colors">
                            <i class="fa fa-info-circle w-5 text-center mr-3"></i>
                            <span>关于我们</span>
                        </a>
                    </nav>
                    
                    <div class="p-4 border-t border-gray-100 mt-2">
                        <button id="logout-btn" class="w-full flex items-center justify-center px-4 py-2 border border-danger text-danger rounded-lg hover:bg-danger hover:text-white transition-colors">
                            <i class="fa fa-sign-out mr-2"></i>
                            <span>退出登录</span>
                        </button>
                    </div>
                </div>
            </div>
            
            <!-- 右侧设置内容 -->
            <div class="lg:w-3/4">
                <!-- 集成服务 -->
                <section id="integrations" class="bg-white rounded-xl shadow-sm overflow-hidden">
                    <div class="p-6 border-b border-gray-100">
                        <h2 class="text-xl font-bold">集成服务</h2>
                        <p class="text-gray-500 mt-1">连接第三方应用和服务</p>
                    </div>
                    
                    <div class="p-6">
                        <div class="space-y-4">
                            <div class="flex items-center justify-between p-4 border border-gray-200 rounded-lg">
                                <div class="flex items-center">
                                    <div class="w-10 h-10 rounded bg-[#4285F4]/10 flex items-center justify-center text-[#4285F4]">
                                        <i class="fa fa-google"></i>
                                    </div>
                                    <div class="ml-4">
                                        <h4 class="text-sm font-medium">Google</h4>
                                        <p class="text-xs text-gray-500">同步日历和邮件</p>
                                    </div>
                                </div>
                                <button class="connect-service px-3 py-1 border border-gray-300 rounded text-sm text-gray-700 hover:bg-gray-50 transition-colors" data-service="google">
                                    连接
                                </button>
                            </div>
                            
                            <div class="flex items-center justify-between p-4 border border-gray-200 rounded-lg">
                                <div class="flex items-center">
                                    <div class="w-10 h-10 rounded bg-[#0078D7]/10 flex items-center justify-center text-[#0078D7]">
                                        <i class="fa fa-windows"></i>
                                    </div>
                                    <div class="ml-4">
                                        <h4 class="text-sm font-medium">Microsoft</h4>
                                        <p class="text-xs text-gray-500">同步Office 365数据</p>
                                    </div>
                                </div>
                                <button class="connect-service px-3 py-1 border border-gray-300 rounded text-sm text-gray-700 hover:bg-gray-50 transition-colors" data-service="microsoft">
                                    连接
                                </button>
                            </div>
                            
                            <div class="flex items-center justify-between p-4 border border-gray-200 rounded-lg">
                                <div class="flex items-center">
                                    <div class="w-10 h-10 rounded bg-[#1DA1F2]/10 flex items-center justify-center text-[#1DA1F2]">
                                        <i class="fa fa-twitter"></i>
                                    </div>
                                    <div class="ml-4">
                                        <h4 class="text-sm font-medium">Twitter</h4>
                                        <p class="text-xs text-gray-500">分享更新到Twitter</p>
                                    </div>
                                </div>
                                <button class="connected-service px-3 py-1 border border-success/30 bg-success/5 rounded text-sm text-success" disabled>
                                    <i class="fa fa-check mr-1"></i>已连接
                                </button>
                            </div>
                            
                            <div class="flex items-center justify-between p-4 border border-gray-200 rounded-lg">
                                <div class="flex items-center">
                                    <div class="w-10 h-10 rounded bg-[#25D366]/10 flex items-center justify-center text-[#25D366]">
                                        <i class="fa fa-whatsapp"></i>
                                    </div>
                                    <div class="ml-4">
                                        <h4 class="text-sm font-medium">WhatsApp</h4>
                                        <p class="text-xs text-gray-500">接收重要通知</p>
                                    </div>
                                </div>
                                <button class="connect-service px-3 py-1 border border-gray-300 rounded text-sm text-gray-700 hover:bg-gray-50 transition-colors" data-service="whatsapp">
                                    连接
                                </button>
                            </div>
                            
                            <div class="flex items-center justify-between p-4 border border-gray-200 rounded-lg">
                                <div class="flex items-center">
                                    <div class="w-10 h-10 rounded bg-[#FF0000]/10 flex items-center justify-center text-[#FF0000]">
                                        <i class="fa fa-youtube-play"></i>
                                    </div>
                                    <div class="ml-4">
                                        <h4 class="text-sm font-medium">YouTube</h4>
                                        <p class="text-xs text-gray-500">同步订阅和播放列表</p>
                                    </div>
                                </div>
                                <button class="disconnect-service px-3 py-1 border border-danger/30 bg-danger/5 rounded text-sm text-danger" data-service="youtube">
                                    <i class="fa fa-times mr-1"></i>断开连接
                                </button>
                            </div>
                        </div>
                        
                        <div class="mt-8 p-4 bg-blue-50 rounded-lg border border-blue-100">
                            <div class="flex">
                                <div class="flex-shrink-0">
                                    <i class="fa fa-info-circle text-blue-500 mt-0.5"></i>
                                </div>
                                <div class="ml-3">
                                    <h3 class="text-sm font-medium text-blue-800">集成服务说明</h3>
                                    <div class="mt-2 text-sm text-blue-700">
                                        <p>连接第三方服务后，UserHub将获得有限的访问权限，用于数据同步和功能扩展。</p>
                                        <p class="mt-1">您可以随时断开连接，撤销访问权限。</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </main>

    <!-- 服务连接确认模态框 -->
    <div id="service-connection-modal" class="fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center hidden">
        <div class="bg-white rounded-xl shadow-xl w-full max-w-md mx-4">
            <div class="p-6 border-b border-gray-100 flex justify-between items-center">
                <h3 class="text-lg font-bold" id="connection-modal-title">连接 Google</h3>
                <button class="close-modal text-gray-400 hover:text-gray-500">
                    <i class="fa fa-times"></i>
                </button>
            </div>
            <div class="p-6">
                <p class="text-gray-600" id="connection-modal-message">
                    连接 Google 后，UserHub 将能够访问您的日历和邮件数据，以便提供更好的任务提醒服务。
                </p>
                
                <div class="mt-4 p-3 bg-gray-50 rounded-lg text-sm">
                    <p class="font-medium mb-1">将获取以下权限：</p>
                    <ul class="list-disc pl-5 text-gray-600 space-y-1" id="permission-list">
                        <li>查看和管理您的日历事件</li>
                        <li>发送邮件提醒</li>
                    </ul>
                </div>
            </div>
            <div class="p-6 border-t border-gray-100 flex justify-end space-x-3">
                <button class="cancel-modal px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors">
                    取消
                </button>
                <button id="confirm-connection" class="px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors">
                    继续连接
                </button>
            </div>
        </div>
    </div>

    <!-- 断开连接确认模态框 -->
    <div id="service-disconnection-modal" class="fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center hidden">
        <div class="bg-white rounded-xl shadow-xl w-full max-w-md mx-4">
            <div class="p-6 border-b border-gray-100 flex justify-between items-center">
                <h3 class="text-lg font-bold" id="disconnection-modal-title">断开 YouTube 连接</h3>
                <button class="close-modal text-gray-400 hover:text-gray-500">
                    <i class="fa fa-times"></i>
                </button>
            </div>
            <div class="p-6">
                <p class="text-gray-600">
                    断开连接后，UserHub 将不再能够访问您的 YouTube 数据，相关功能将受到影响。
                </p>
            </div>
            <div class="p-6 border-t border-gray-100 flex justify-end space-x-3">
                <button class="cancel-modal px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors">
                    取消
                </button>
                <button id="confirm-disconnection" class="px-4 py-2 bg-danger text-white rounded-lg hover:bg-danger/90 transition-colors">
                    确认断开
                </button>
            </div>
        </div>
    </div>

    <!-- 成功提示 Toast -->
    <div id="success-toast" class="fixed bottom-6 right-6 bg-success text-white px-6 py-3 rounded-lg shadow-lg transform translate-y-20 opacity-0 transition-all duration-300 flex items-center">
        <i class="fa fa-check-circle mr-2"></i>
        <span id="toast-message">操作成功</span>
    </div>

    <!-- 页脚 -->
    <footer class="bg-white border-t border-gray-200 py-8 mt-auto">
        <div class="container mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="flex items-center mb-4 md:mb-0">
                    <i class="fa fa-connectdevelop text-primary text-xl mr-2"></i>
                    <span class="font-bold text-lg text-primary">UserHub</span>
                </div>
                <div class="flex space-x-6">
                    <a href="https://weixin.qq.com" class="text-gray-400 hover:text-primary transition-colors duration-200" title="微信">
                    <i class="fa fa-weixin text-xl"></i>
                </a>
                <a href="https://im.qq.com/index" class="text-gray-400 hover:text-primary transition-colors duration-200" title="QQ">
                    <i class="fa fa-qq text-xl"></i>
                </a>
                <a href="https://weibo.com/newlogin?tabtype=weibo&gid=102803&openLoginLayer=0&url=https%3A%2F%2Fweibo.com%2F" class="text-gray-400 hover:text-primary transition-colors duration-200" title="微博">
                    <i class="fa fa-weibo text-xl"></i>
                </a>
                </div>
            </div>
            <div class="mt-6 border-t border-gray-200 pt-6 flex flex-col md:flex-row justify-between items-center">
                <p class="text-sm text-gray-500">
                    &copy; 2025 UserHub. 保留所有权利.
                </p>
                <div class="mt-4 md:mt-0 flex space-x-6">
                    <a href="privacy-policy.html" class="text-sm text-gray-500 hover:text-primary transition-colors duration-200">隐私政策</a>
                    <a href="terms-of-service.html" class="text-sm text-gray-500 hover:text-primary transition-colors duration-200">使用条款</a>
                    <a href="help-center.html" class="text-sm text-gray-500 hover:text-primary transition-colors duration-200">帮助中心</a>
                </div>
            </div>
        </div>
    </footer>

    <!-- 引入自定义JS -->
    <script src="settings-integrations.js"></script>
</body>
</html>
